package huixue.cn.com.rxapp.ui;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.chaychan.library.BottomBarItem;
import com.chaychan.library.BottomBarLayout;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import huixue.cn.com.library.widget.NoScrollViewPager;
import huixue.cn.com.rxapp.R;
import huixue.cn.com.rxapp.adapter.MainTabAdapter;
import huixue.cn.com.rxapp.base.BaseActivity;
import huixue.cn.com.rxapp.base.BaseFragment;
import huixue.cn.com.rxapp.base.SimpleActivity;
import huixue.cn.com.rxapp.fragment.HomeFragment;
import huixue.cn.com.rxapp.fragment.ImageFragment;
import huixue.cn.com.rxapp.fragment.NewsFragment;

public class MainIndexActivity extends SimpleActivity {

    @BindView(R.id.vp_content)
    NoScrollViewPager mVpContent;

    @BindView(R.id.bottom_bar)
    BottomBarLayout mBottomBarLayout;

    private List<BaseFragment> mFragments;
    private MainTabAdapter mTabAdapter;

    private int[] mStatusColors = new int[]{
            R.color.color_D33D3C,
            R.color.color_BDBDBD,
            R.color.color_BDBDBD,
    };

    @Override
    public int getLayout() {
        return R.layout.activity_main_index;
    }

    @Override
    public void initView() {

    }

    @Override
    public void addEvent() {
        mFragments = new ArrayList<>(4);
        mFragments.add(new HomeFragment());
        mFragments.add(new NewsFragment());
        mFragments.add(new ImageFragment());
        mFragments.add(new ImageFragment());

        mTabAdapter = new MainTabAdapter(mFragments, getSupportFragmentManager());
        mVpContent.setAdapter(mTabAdapter);
        mVpContent.setOffscreenPageLimit(mFragments.size());
        mBottomBarLayout.setViewPager(mVpContent);

        mBottomBarLayout.setOnItemSelectedListener(new BottomBarLayout.OnItemSelectedListener() {
            @Override
            public void onItemSelected(BottomBarItem bottomBarItem, int i, int i1) {

            }
        });
    }



}
